<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
      layout:decorate="~{layout/base}">
<head>
    <title>个人信息 - 暖心助农选品平台</title>
</head>
<body>
    <div layout:fragment="content">
        <div class="row">
            <div class="col-md-6 mx-auto" >
                <div class="card">
                    <div class="card-header">
                        <h5 class="card-title mb-0">基本信息</h5>
                    </div>
                    <div class="card-body">
                        <form th:action="@{/profile/update}" method="post">
                            <div class="mb-3">
                                <label class="form-label">用户名</label>
                                <input type="text" class="form-control" th:value="${user.username}" readonly>
                            </div>
                            <div class="mb-3">
                                <label class="form-label">角色</label>
                                <input type="text" class="form-control" th:value="${user.role.getDisplayName()}" readonly>
                            </div>
                            <div class="mb-3">
                                <label class="form-label">真实姓名</label>
                                <input type="text" class="form-control" name="realName" th:value="${user.realName}" required>
                            </div>
                            <div class="mb-3">
                                <label class="form-label">联系电话</label>
                                <input type="tel" class="form-control" name="phone" th:value="${user.phone}" required>
                            </div>
                            <div class="mb-3">
                                <label class="form-label">收货地址</label>
                                <textarea class="form-control" name="address" rows="3" required th:text="${user.address}"></textarea>
                            </div>
                            <div sec:authorize="hasRole('EMPLOYEE')" class="mb-3">
                                <label class="form-label">账户余额</label>
                                <div class="input-group">
                                    <span class="input-group-text">￥</span>
                                    <input type="text" class="form-control" th:value="${user.balance}" readonly>
                                </div>
                            </div>
                            <button type="submit" class="btn btn-primary">保存修改</button>
                        </form>
                    </div>
                </div>
            </div>
            
            <!-- <div class="col-md-6">
                <div class="card">
                    <div class="card-header">
                        <h5 class="card-title mb-0">修改密码</h5>
                    </div>
                    <div class="card-body">
                        <form th:action="@{/profile/password}" method="post">
                            <div class="mb-3">
                                <label class="form-label">当前密码</label>
                                <input type="password" class="form-control" name="oldPassword" required>
                            </div>
                            <div class="mb-3">
                                <label class="form-label">新密码</label>
                                <input type="password" class="form-control" name="newPassword" required>
                            </div>
                            <div class="mb-3">
                                <label class="form-label">确认新密码</label>
                                <input type="password" class="form-control" name="confirmPassword" required>
                            </div>
                            <button type="submit" class="btn btn-primary">修改密码</button>
                        </form>
                    </div>
                </div>
            </div> -->
        </div>
    </div>
</body>
</html> 